package subject_set.weekly_competition.day10_9;

/**
 * @author haomin
 * @date 2022/10/09 10:22
 **/
public class Num1 {
    class Solution {
        public int hardestWorker(int n, int[][] logs) {
            int[] persons = new int[n];
            int pre = 0;

            for(int i = 0; i < logs.length; ++i){
                int[] data = logs[i];
                persons[data[0]] = Math.max(persons[data[0]], data[1]-pre);

                pre = data[1];
            }
            int id = 0;
            int max = Integer.MIN_VALUE;
            for(int i = 0; i < n; ++i){
                if(max < persons[i]){
                    max = persons[i];
                    id = i;
                }
            }
            return id;
        }
    }

}